#pragma once

#include "itask.h"
#include "itaskmgr.h"
#include <windows.h>


class CXWinThread;

DWORD WINAPI ThreadFunc(LPVOID pt);

class CXWinThread : public IThread
{
public:
    // Function to execute in current thread
    friend DWORD WINAPI ThreadFunc(LPVOID pt);

    CXWinThread(ITaskMgr*,HANDLE,HANDLE);

    ~CXWinThread();

    // Query of process terminating
    void Close();

private:
    ITaskMgr* _mgr;
    ITask*    _task;
	HANDLE    _hevent;
	HANDLE    _hmutex;
	HANDLE    _hthread;
	bool      _close;    
};

